﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;

namespace Mono.Collections.Generic
{
	// Token: 0x0200000E RID: 14
	public sealed class ReadOnlyCollection<T> : Collection<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IList, ICollection
	{
		// Token: 0x1700000D RID: 13
		// (get) Token: 0x06000062 RID: 98 RVA: 0x0000A364 File Offset: 0x00008564
		public static ReadOnlyCollection<T> Empty
		{
			get
			{
				bool flag = ReadOnlyCollection<T>.empty != null;
				ReadOnlyCollection<T> result;
				if (flag)
				{
					result = ReadOnlyCollection<T>.empty;
				}
				else
				{
					Interlocked.CompareExchange<ReadOnlyCollection<T>>(ref ReadOnlyCollection<T>.empty, new ReadOnlyCollection<T>(), null);
					result = ReadOnlyCollection<T>.empty;
				}
				return result;
			}
		}

		// Token: 0x1700000E RID: 14
		// (get) Token: 0x06000063 RID: 99 RVA: 0x0000A3A0 File Offset: 0x000085A0
		bool ICollection<T>.IsReadOnly
		{
			get
			{
				return true;
			}
		}

		// Token: 0x1700000F RID: 15
		// (get) Token: 0x06000064 RID: 100 RVA: 0x0000A3A0 File Offset: 0x000085A0
		bool IList.IsFixedSize
		{
			get
			{
				return true;
			}
		}

		// Token: 0x17000010 RID: 16
		// (get) Token: 0x06000065 RID: 101 RVA: 0x0000A3A0 File Offset: 0x000085A0
		bool IList.IsReadOnly
		{
			get
			{
				return true;
			}
		}

		// Token: 0x06000066 RID: 102 RVA: 0x00002A70 File Offset: 0x00000C70
		private ReadOnlyCollection()
		{
		}

		// Token: 0x06000067 RID: 103 RVA: 0x0000A3B4 File Offset: 0x000085B4
		public ReadOnlyCollection(T[] array)
		{
			bool flag = array == null;
			if (flag)
			{
				throw new ArgumentNullException();
			}
			this.Initialize(array, array.Length);
		}

		// Token: 0x06000068 RID: 104 RVA: 0x0000A3E4 File Offset: 0x000085E4
		public ReadOnlyCollection(Collection<T> collection)
		{
			bool flag = collection == null;
			if (flag)
			{
				throw new ArgumentNullException();
			}
			this.Initialize(collection.items, collection.size);
		}

		// Token: 0x06000069 RID: 105 RVA: 0x00002A7A File Offset: 0x00000C7A
		private void Initialize(T[] items, int size)
		{
			this.items = new T[size];
			Array.Copy(items, 0, this.items, 0, size);
			this.size = size;
		}

		// Token: 0x0600006A RID: 106 RVA: 0x00002AA0 File Offset: 0x00000CA0
		internal override void Grow(int desired)
		{
			throw new InvalidOperationException();
		}

		// Token: 0x0600006B RID: 107 RVA: 0x00002AA0 File Offset: 0x00000CA0
		protected override void OnAdd(T item, int index)
		{
			throw new InvalidOperationException();
		}

		// Token: 0x0600006C RID: 108 RVA: 0x00002AA0 File Offset: 0x00000CA0
		protected override void OnClear()
		{
			throw new InvalidOperationException();
		}

		// Token: 0x0600006D RID: 109 RVA: 0x00002AA0 File Offset: 0x00000CA0
		protected override void OnInsert(T item, int index)
		{
			throw new InvalidOperationException();
		}

		// Token: 0x0600006E RID: 110 RVA: 0x00002AA0 File Offset: 0x00000CA0
		protected override void OnRemove(T item, int index)
		{
			throw new InvalidOperationException();
		}

		// Token: 0x0600006F RID: 111 RVA: 0x00002AA0 File Offset: 0x00000CA0
		protected override void OnSet(T item, int index)
		{
			throw new InvalidOperationException();
		}

		// Token: 0x04000012 RID: 18
		private static ReadOnlyCollection<T> empty;
	}
}
